import React, { Component } from "react";
import NowPlaying from "./Films/nwplaying";
import CommingSoon from "./Films/commingSoon";
import { Route, Switch, NavLink } from "react-router-dom";
import { Redirect } from "react-router-dom/cjs/react-router-dom.min";
export default class films extends Component {
  render() {
    return (
      <div>
        <div style={{ height: "200px", background: "pink" }}>大轮播</div>
        <ul>
          <li>
            <NavLink to="/films/nowPlaying">正在热映</NavLink>
          </li>
          <li>
            <NavLink to="/films/commingSoon">即将上映</NavLink>
          </li>
        </ul>
        <Switch>
          {/* 子路由配置 嵌套路由 */}
          <Route component={NowPlaying} path="/films/nowPlaying" />
          <Route component={CommingSoon} path="/films/commingSoon" />
          <Redirect from="/films" to="/films/nowPlaying" />
        </Switch>
      </div>
    );
  }
}
